package com.manli.api.controller;

import java.util.Arrays;
import java.util.Map;
import com.manli.api.pojo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import com.manli.api.base.annotation.Permissions;
import com.manli.api.pojo.QueryParams;
import com.manli.api.dto.ActivityLog;
import com.manli.api.service.ActivityLogService;



/**
 * 活动日志表
 *
 * @author manli
 * @email 
 * @date 2020-07-25 20:04:58
 */
@Api(value="/activitylog", tags="活动日志表")
@RestController
@RequestMapping("api/activitylog")
public class ActivityLogController {
    @Autowired
    private ActivityLogService activityLogService;

    /**
     * 列表
     */
    @ApiOperation(value = "活动日志表列表",notes = "")
    @PostMapping("/list")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result list(@RequestBody QueryParams params){
        return activityLogService.queryPage(params);
    }

    /**
     * 全部数据信息
     */
    @ApiOperation(value = "活动日志表全部数据信息",notes = "")
    @PostMapping("/all")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result all(){
        return activityLogService.queryAll();
    }

    /**
     * 单条信息
     */
    @ApiOperation(value = "活动日志表单条信息",notes = "活动日志表单条信息")
    @GetMapping("/info/{activityLogId}")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result info(@PathVariable("activityLogId") Integer activityLogId){
        return activityLogService.getById(activityLogId);
    }

    /**
     * 保存
     */
    @ApiOperation(value = "活动日志表保存",notes = "活动日志表保存")
    @PostMapping("/save")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result save(@RequestBody ActivityLog activityLog){
        return activityLogService.save(activityLog);
    }

    /**
     * 修改
     */
    @ApiOperation(value = "活动日志表修改",notes = "活动日志表修改")
    @PostMapping("/update")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result update(@RequestBody ActivityLog activityLog){
        return activityLogService.updateById(activityLog);
    }


    /**
     * 删除多条数据
     */
    @ApiOperation(value = "活动日志表删除",notes = "活动日志表删除")
    @ApiImplicitParam(name = "activityLogIds", value = "id数组,json字符串",dataType = "id数组,json字符串", required = true)
    @PostMapping("/deleteIds")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result deleteIds(@RequestBody Integer[] activityLogIds){
        return activityLogService.removeByIds(Arrays.asList(activityLogIds));
    }

}
